<%@ page contentType="text/html; charset=UTF-8" %> 
<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="w40k-layout" %>
<%@ taglib tagdir="/WEB-INF/tags/mathammer" prefix="mathammer" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<w40k-layout:headers baseRef="${baseRef}"/>
</head>
<body>
	<w40k-layout:layout pageId="mathammer" >
		
		<mathammer:formUnit baseUrl="${baseRef}mathammer" modelAttribute="model"/>
		
		<mathammer:listunits baseUrl="${baseRef}mathammer" units="${attackers}" unitType="attackers"/>
		
		<mathammer:listunits baseUrl="${baseRef}mathammer" units="${defenders}" unitType="defenders"/>

		<c:if test="${not empty shootingResult or not empty ccResult}">
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">Shooting</a></li>
					<li><a href="#tabs-2">Close Combat</a></li>
				</ul>				
				<div id="tabs-1">
					<table id="resultats">
						<caption>Résultat</caption>
						<thead><tr><th>Nb attaques</th><th>% to-hit</th><th>Nb Hit</th><th>% to-wound</th><th>Nb wound</th><th>% to-save</th><th>Nb saved</th><th>Nb defender left</th></tr></thead>
						<tbody>
							<c:set var="rowClass" value="pair" />
							<tr class="${rowClass}">
								<td>${shootingResult.nbAttacks}</td>
								<td>${shootingResult.toHit}</td>
								<td>${shootingResult.nbHits}</td>
								<td>${shootingResult.toWound}</td>
								<td>${shootingResult.nbWounded}</td>
								<td>${shootingResult.toSave}</td>
								<td>${shootingResult.nbSaved}</td>
								<td>${shootingResult.nbDefenderLeft}</td>
							</tr>						
						</tbody>				
					</table>
				</div>
				<div id="tabs-2">
					<table id="resultats">
						<caption>Résultat</caption>
						<thead><tr><th>Nb attaques</th><th>% to-hit</th><th>Nb Hit</th><th>% to-wound</th><th>Nb wound</th><th>% to-save</th><th>Nb saved</th><th>Nb defender left</th></tr></thead>
						<tbody>
							<c:set var="rowClass" value="pair" />
							<tr class="${rowClass}">
								<td>${ccResult.nbAttacks}</td>
								<td>${ccResult.toHit}</td>
								<td>${ccResult.nbHits}</td>
								<td>${ccResult.toWound}</td>
								<td>${ccResult.nbWounded}</td>
								<td>${ccResult.toSave}</td>
								<td>${ccResult.nbSaved}</td>
								<td>${ccResult.nbDefenderLeft}</td>
							</tr>			
						</tbody>				
					</table>
				</div>
			</div>
		</c:if>
	</w40k-layout:layout>	
</body>
</html>